# Created by: Olivier Duchateau
# $FreeBSD$

PORTNAME=	lightdm
PORTVERSION=	1.8.8
CATEGORIES=	x11
MASTER_SITES=	https://launchpadlibrarian.net/169293146/ \
	https://launchpad.net/${PORTNAME}/${PORTVERSION:R}/${PORTVERSION}/+download/

MAINTAINER=	ports@FreeBSD.org
COMMENT=	Lightweight display manager

LICENSE=	GPLv3 LGPL20 LGPL3
LICENSE_COMB=	multi

BUILD_DEPENDS=	${LOCALBASE}/libdata/pkgconfig/iso-codes.pc:${PORTSDIR}/misc/iso-codes \
	itstool:${PORTSDIR}/textproc/itstool
LIB_DEPENDS=	libxklavier.so:${PORTSDIR}/x11/libxklavier \
	libgcrypt.so:${PORTSDIR}/security/libgcrypt

GNU_CONFIGURE=	yes
USES=	tar:xz pkgconfig gmake gettext pathfix
USE_GNOME=	glib20 introspection:build intlhack intltool libxml2
USE_XORG=	x11 xdmcp xcb ice
USE_LDCONFIG=	yes

USE_RC_SUBR=	lightdm
SUB_FILES=	pkg-message

USERS=	lightdm
GROUPS=	lightdm

CONFIGURE_ARGS=	--enable-introspection \
	--disable-tests \
	--disable-gtk-doc-html \
	--without-html-dir \
	--without-help-dir

OPTIONS_DEFINE=	QT4

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MQT4}
USE_QT4=	moc dbus gui
CONFIGURE_ARGS+=--enable-liblightdm-qt \
	--disable-liblightdm-qt5
PLIST_SUB+=	QT4=""
.else
CONFIGURE_ARGS+=--disable-liblightdm-qt \
	--disable-liblightdm-qt5
PLIST_SUB+=	QT4="@comment "
.endif

post-patch:
	${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' \
		${WRKSRC}/data/lightdm.conf
	${CP} ${WRKSRC}/data/lightdm.conf \
		${WRKSRC}/data/lightdm.conf.sample

.include <bsd.port.mk>
